﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace A6
{
    public partial class delete: Form
    {
        private OrderService orderService;
        public delete(OrderService _orderService)
        {
            InitializeComponent();
            orderService = _orderService;
        }

        private void label1_Click(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                orderService.DeleteOrder(Int32.Parse(textBox1.Text));
                MessageBox.Show("订单删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"删除失败: {ex.Message}");
                Close();
            }
        }
    }
}
